package clientGUI.user.Controllers.ISD;

import java.util.ArrayList;

import college.Request;

import clientGUI.Controllers.Controller;
import clientserver.Client;
import clientserver.Packet;
import clientserver.QueryResult;

public class ISDRequestController extends Controller {

	private ArrayList<String> rids;
	
public ISDRequestController(Client cl)
{
	client=cl;
	rids= new ArrayList<String>();
	String q="SELECT *FROM requests";
	Packet p=new Packet(q);
	QueryResult res=(QueryResult) client.SendPacketAndWait(p);

	for(int i=0; i<res.rowsize();i++)
	{

		String s=res.getString("id");
rids.add(s);
		res.next();
	}
	
}

public ArrayList<String>  getallrids()
{
	return rids;
}

public String getReport( String rid)
{
	int id= Integer.parseInt(rid);
	
	Request r= new Request(client);
	r.loadFromDb(id);
	return r.toString();
}
	
}
